import type { IColumnsOption } from 'vc';
import { INDEX, COMPANY_NAME, INFO_SOURCE, PROVINCE, CITY, INDUSTRY_CATEGORY, BUSINESS_DATA, REGISTERED_CAPITAL } from '@/utils';

export function useTable() {
  const tableData = ref([]);

  const columns = ref<IColumnsOption[]>([
    { ...INDEX },
    { ...COMPANY_NAME },
    {
      title: '披露日期',
      field: 'noticeDate',
      width: 100,
      align: 'center',
      sortable: true,
      sortBy: 'noticeDate'
    },
    { ...INFO_SOURCE('') },
    {
      title: '认定级别',
      field: 'levelCode',
      width: 100,
      align: 'center',
      sortable: true,
      sortBy: 'levelCode'
    },
    {
      title: '认定批次',
      field: 'batch',
      width: 100,
      align: 'center',
      sortable: true,
      sortBy: 'batch'
    },
    {
      title: '发布单位',
      field: 'dataSource',
      width: 200,
      sortable: true,
      sortBy: 'dataSource'
    },
    {
      title: '推荐单位',
      field: 'recommendationAuthority',
      width: 200,
      sortable: true,
      sortBy: 'productType'
    },
    {
      title: '细分行业',
      field: 'productType',
      width: 120,
      align: 'center',
      sortable: true,
      sortBy: 'productType'
    },
    {
      title: '产品类别',
      field: 'productName',
      width: 120,
      sortable: true,
      sortBy: 'productName'
    },
    { ...PROVINCE },
    { ...CITY },
    { ...INDUSTRY_CATEGORY },
    { ...BUSINESS_DATA },
    { ...REGISTERED_CAPITAL }
  ]);

  return {
    tableData,
    columns
  };
}
